#define  _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    int findPoisonedDuration(vector<int>& timeSeries, int duration) {
        int count = duration;
        for (int i = 0; i < timeSeries.size() - 1; i++)
        {
            int cur = timeSeries[i], next = timeSeries[i + 1];
            count += min(next - cur, duration);
        }
        return count;
    }
};